package com.meowcook.mapper;

import com.meowcook.pojo.dto.CookerAddDTO;
import com.meowcook.pojo.dto.CookerUpdateDTO;
import com.meowcook.pojo.po.Cooker;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 28792
 * Date: 2025-05-15
 * Time: 18:59
 */
@Mapper(componentModel = "spring")
public interface CookerPojoMapper {
    CookerPojoMapper INSTANCE = Mappers.getMapper(CookerPojoMapper.class);

    @Mappings({
            @Mapping(source = "name", target = "name"),
            @Mapping(source = "quantity", target = "quantity")
    })
    Cooker toPO(CookerAddDTO cookerAddDTO);

    @Mappings({
            @Mapping(source = "id", target = "id"),
            @Mapping(source = "name", target = "name"),
            @Mapping(source = "quantity", target = "quantity")
    })
    Cooker toPO(CookerUpdateDTO cookerUpdateDTO);

    @Mappings({
            @Mapping(source = "name", target = "name"),
            @Mapping(source = "quantity", target = "quantity")
    })
    List<Cooker> toPO(List<CookerAddDTO> cookerAddDTOS);

    @Mappings({
            @Mapping(source = "id", target = "id"),
            @Mapping(source = "name", target = "name"),
            @Mapping(source = "quantity", target = "quantity")
    })
    List<Cooker> updateToPO(List<CookerUpdateDTO> cookerUpdateDTOS);
}
